home *** CD-ROM | disk | FTP | other *** search
/ PC Graphics Unleashed / PC Graphics Unleashed.iso / ch17 / pi / quadratc / quadratc.pi < prev   
Encoding:
Text File  |  1994-08-05  |  2.5 KB  |  91 lines

  1. // Scene File: QUADRATC.PI
  2. // Author: Rob McGregor
  3.  
  4. /************************************************* 
  5.   Three spheres follow different quadratic paths,
  6.   starting and ending at the same points
  7. **************************************************/
  8.  
  9. include "..\..\..\colors.inc"
  10. include "..\..\..\texture.inc"
  11.  
  12. // SET UP THE CAMERA
  13. viewpoint {
  14.   from       <4.5, 0, -12>
  15.   at         <4.5, 1, 0>
  16.   up         <0, 1, 0>
  17.   angle      45
  18.   resolution 320, 200
  19.   aspect     1.6
  20. }
  21.  
  22. // Set the sky color and add a little haze
  23. background Grey
  24. haze 0.98, 25, Grey
  25.  
  26. // Lights
  27. light <-5, 5, -20>
  28. light <5, 5, -20>
  29.  
  30. // Define the range of the animation
  31. start_frame   0
  32. end_frame     49
  33. outfile       "quad"
  34.  
  35. define s1_Nc -5.0 // Nc for sphere1 (red)
  36. define s2_Nc  2.5 // Nc for sphere2 (yellow)
  37. define s3_Nc 10.0 // Nc for sphere3 (blue)
  38.  
  39. // Sphere1
  40. define s1N1x  0 // x-axis starting point
  41. define s1N1y -1 // y-axis starting point
  42. define s1N2x  9 // x-axis ending point
  43. define s1N2y -1 // y-axis ending point
  44.  
  45. // Sphere2
  46. define s2N1x  0 // x-axis starting point
  47. define s2N1y  0 // y-axis starting point
  48. define s2N2x  9 // x-axis ending point
  49. define s2N2y  0 // y-axis ending point
  50.  
  51. // Sphere3
  52. define s3N1x  0 // x-axis starting point
  53. define s3N1y  1 // y-axis starting point
  54. define s3N2x  9 // x-axis ending point
  55. define s3N2y  1 // y-axis ending point
  56.  
  57. // Calculate the value of t as:
  58. //   t = (F - F1) / (F2 - F1)
  59. define t (frame - start_frame) / (end_frame - start_frame)
  60.  
  61. // Now calculate the locations of the spheres using:
  62. //   N = (1 - t)^2 * N1 + (t^2) * N2 + 2 * t * (1 - t) * Nc
  63.  
  64. define s1_x (1 - t)^2 * s1N1x + (t^2) * s1N2x + 2 * t * (1 - t) * s1_Nc
  65. define s1_y (1 - t)^2 * s1N1y + (t^2) * s1N2y + 2 * t * (1 - t) * s1_Nc
  66. define s2_x (1 - t)^2 * s2N1x + (t^2) * s2N2x + 2 * t * (1 - t) * s2_Nc
  67. define s2_y (1 - t)^2 * s2N1y + (t^2) * s2N2y + 2 * t * (1 - t) * s2_Nc
  68. define s3_x (1 - t)^2 * s3N1x + (t^2) * s3N2x + 2 * t * (1 - t) * s3_Nc
  69. define s3_y (1 - t)^2 * s3N1y + (t^2) * s3N2y + 2 * t * (1 - t) * s3_Nc
  70.  
  71. // Set the positions of the spheres
  72. define s1_loc <s1_x, s1_y, 0>
  73. define s2_loc <s2_x, s2_y, 0>
  74. define s3_loc <s3_x, s3_y, 0>
  75.  
  76. // Create 3 spheres
  77. object { sphere s1_loc, 0.5 reflective_red }
  78. object { sphere s2_loc, 0.5 reflective_yellow }
  79. object { sphere s3_loc, 0.5 reflective_blue }
  80.  
  81. // The floor...
  82. object {
  83.   disc <0, 0, 0>, <0, 1, 0>, 10000
  84.   texture { 
  85.     checker steely_blue, 
  86.     texture { shiny { color white }}
  87.   }
  88.   rotate <0, 25, 0>
  89.   translate <0, -3.5, 0>
  90. }
  91.